#ifndef __ADSORPTION_H__
#define __ADSORPTION_H__

#include "Map.h"

class Adsorption
{
	struct LabelFinder
	{
		std::string sId;
		LabelFinder(std::string s)
			:sId(s)
		{
		}
		bool operator()(Label* n)
		{
			return n->data == sId;
		}
	};

	struct LabelComparer
		: std::binary_function<Label*,Label*,bool>
	{
		inline bool operator()(const Label* lhs, const Label* rhs)
		{
			return lhs->weight > rhs->weight;
		}
	};


	static void CalculateDv(Node *v, ListEdge &neighbors, 
		LabelDistribution &estimatedDist, ListLabel &lstDv);
	static void UpdateEstimatedDistribution(Node *v, ListLabel &Dv,
		ListLabel &initY_v, ListNumber &probs,
		ListLabel &estimatedLabels);
	static void ProcessGraph(Graph &graph, LabelDistribution &initDist,
		MapNumber &probs, LabelDistribution &estimatedDist);
	static void SortLabelDist(LabelDistribution &distribution);

	static void InitDistribution(AdsorptionData &data);
public:

	static void Process(AdsorptionData &data, int iLoopCnt);
};

#endif